﻿Imports System.Data.OleDb
Imports System.Data
Imports System.Xml
Imports System.Xml.Linq


Public Class about
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim connection As OleDbConnection
        Dim app_path As String
        Dim xtw As XmlTextWriter
        Dim cmd As OleDbCommand
        Dim dataR As OleDbDataReader
        app_path = System.AppDomain.CurrentDomain.BaseDirectory()
        connection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & app_path & "\\App_Data\\WineDb.accdb;Persist Security Info=True")
        xtw = New XmlTextWriter(Response.OutputStream, Encoding.UTF8)
        xtw.WriteStartDocument()
        xtw.WriteStartElement("rss")
        xtw.WriteStartAttribute("version", "2.0")
        xtw.WriteStartElement("channel")
        xtw.WriteElementString("title", "Rss Feed best wines")
        connection.Open()
        cmd = New OleDbCommand("select * from wined", connection)
        dataR = cmd.ExecuteReader()
        While dataR.Read()
            xtw.WriteStartElement("item")
            xtw.WriteElementString("title", dataR("Brands").ToString())
            xtw.WriteElementString("description", dataR("Brands").ToString())
            xtw.WriteElementString("link", "http://localhost:1952/Home.aspx?id=" & dataR("ID").ToString())
            xtw.WriteEndElement()

        End While
        xtw.WriteEndElement()
        xtw.WriteEndElement()
        xtw.WriteEndDocument()
        xtw.Flush()
        connection.Close()
        Response.End()
    End Sub

End Class